package behavior.strategy;

/**
 * @author dali
 * @date 2021-07-29 10:32
 * @Description
 */

public class Tradition {
    /**
     *
     * @param way 出行方式
     * @param distance 出行距离
     */
    public static int fee(String way,int distance) {
        int trafficFee = 0;
        switch (way) {
            case "bus":
                trafficFee = 1 * distance;
                break;
            case "didi":
                if(distance<=3)
                    trafficFee = 5;
                else
                    trafficFee=5+(distance-3)*2;
                break;
            case "bicycle":
                trafficFee = 2 * distance/5;
                break;
            default:
                break;
        }
        return trafficFee;
    }

    public static void main(String[] args) {
        int s1 = fee("bus",5);
        int s2 = fee("didi",5);
        int s3 = fee("bicycle",5);
        System.out.println(s1 + ":" + s2 +":"+ s3);
    }
}
